home *** CD-ROM | disk | FTP | other *** search
- ; ABORT1_0
- ;
- ;
- ; Resident program that aborts current process with ^R_shift and returns
- ; to originating process (eg, if run by DOS, returns to DOS).
- ; A more powerful version of ^Bk, which just jams and doesn't allow
- ; recovery (back to DOS or originating program) in some prgrams.
- ; For recalcitrant programs that aren't currently or never did listen to
- ; the keyboard. Also for programs that take dozens of keystrokes to exit
- ; (like symphony). Use when you want it to exit, not when it wants to exit.
- ; Leaves return code 0Fh, which can be interrogated by BATCH IF and
- ; ERRORLEVEL, and DOS fn 4Dh.
- ; So far it's compatible with Sidekick (can be installed before or
- ; after). Abort detects whether it is loaded and reloading ABORT produces no
- ; action. When coresident with other hooked int9 programs (those activated
- ; by the keyboard, such as sidekick) sometime ABORT cannot tell that it's
- ; already loaded in which case a second attempt to load ABORT will lock up
- ; the machine. It doesn't always happen, so I dont know the whole story yet.
- ; Generally ABORT seems benign, however let me know about any bugs or
- ; improvements.
- ;
- ; Assembled with IBM MASM 1.00
- ;
- ; From a idea in Breakpt.com, a program by Edward Batulis (c) 1985,
- ; published in Byte, Sep 86, p127
- ;
- ; Joe Mack, Sept '86
- ; Dept Chemistry, UMBC
- ; 5401 Wilkens Ave
- ; Catonsville,MD,21228
- ; (301)-455-3292 afternoons best
- ;
- ; or MIX BBS, leave a message in "ADV" conference
- ; 301-480-0350 1200-8-N-1 (it maybe area code 202- not sure)
- ;
-
- page ,132
- title ABORT1_0
- cseg segment para public 'code'
- assume cs:cseg,ds:cseg
- org 100h
-
- abort proc
-
- jmp install
-
- ;leave secret notice in early code for mad disassemblers
-
- notice db 'ABORT1_0',01Ah
-
- old_int9_vector label dword
- old_int9_offs dw ?
- old_int9_seg dw ?
-
-
- new_int9:
- ;call old keyboard routine by simulating an int
-
- pushf
- call cs:old_int9_vector
-
- push es ;save registers
- push ax
- push bx
-
- mov ax,40h ;look at keyboard flag1 in ROM BIOS data area
- mov es,ax
- mov bx,17h
- mov al,es:[bx]
- and al,05h ;mask all but bit 1, bit 3
- cmp al,5 ;Ctrl-Right Shift pressed?
- ;no, take no action, return to process that was interrupted by the keystroke
- jne quit
-
- ;if so return to originating process
-
- pop bx ;restore registers
- pop ax
- pop es
- popf
-
- mov ah,4Ch ;dos exit fn
- mov al,0Fh ;return code
- int 21h
-
- quit:
- pop bx ;restore before quitting
- pop ax
- pop es
- iret
-
- END_OF_RESIDENT_CODE LABEL BYTE
-
- banner_1 db 'ABORT1_0, Mack 1986',0Dh,0Ah,0Dh,0Ah
- db 'ABORT1_0 installed',0Dh,0Ah
- db 'Resident program, exit anything with ^R_shift combination',0Dh,0Ah
- db 'Key combination detected by int 9h, exits via DOS fn call 4Ch.',0Dh,0Ah
- db 'Leaves return code 0Fh for batch language and DOS fn call 4Dh.',0Dh,0Ah,'$' ,0Dh,0Ah,'$'
-
- banner_2 db 'ABORT1_0, Mack 1986',0Dh,0Ah,0Dh,0Ah
- db 'ABORT already installed',0Dh,0Ah,'$'
-
- install: ;get keyboard interrupt vector
-
- mov ah,35h ;get interrupt vector fn
- mov al,9 ;int 9
- int 21h
-
- cmp bx,offset new_int9 ;are we installed yet?
- jne installz ;if not, install, else exit
-
- ;exit
- mov dx,offset banner_2 ;write banner_2
- mov ah,9
- int 21h
- int 20h ;and exit
-
- installz:
- mov old_int9_offs,bx ;otherwise, save old keyboard interrupt address
- mov old_int9_seg,es
-
- mov dx,offset banner_1 ;print banner_1
- mov ah,9 ;print string
- int 21h
-
- ;set kbd interrupt to point to new_int9
-
- mov ah,25h ;set interrupt fn
- mov al,9 ;int9
- mov dx,offset new_int9 ;new address
- int 21h
-
- ;terminate and stay partially resident, point to last byte of resident code+1
-
- mov dx,offset END_OF_RESIDENT_CODE+1
- int 27h
-
- abort endp
-
- cseg ends
- end abort
-
-